<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="app" uri="/WEB-INF/tld/app.tld" %>
<%@ taglib prefix="ct" uri="/WEB-INF/tld/commonTag.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>  
<%@ include file="/WEB-INF/jsp/common/common_header.jsp" %>
<%@ include file="/WEB-INF/jsp/common/common.jsp" %>

<style>

#gotop {
    position: absolute;
    left: 510px;
    top: 50px;
    background: white;
    width: 100px;
    height: 25000px;
}    
</style>

	<script language="javascript">
	// 매출 팝업 버튼 클릭
	function funcDetail(userId) {
		width = 1000;
		height = 830;
	    x = (screen.width) ? (screen.width-width)/2 : 0;
	    y = (screen.height) ? (screen.height-height)/2 : 0;
	    var popUrl = 'popWithDrawDetailInfo.do?user_id='+userId;
	    var win = window.open(popUrl,'popWithDrawDetailInfo', 'left=' + x + ',top=' + y + ',width=' + width + ',height=' + height + ',scrollbars=yes,status=yes,menubar=no');
		win.focus();
	}
	
	// 카드사입금 팝업 버튼 클릭
	function funcCardDetail(userId) {
		width = 1000;
		height = 800;
	    x = (screen.width) ? (screen.width-width)/2 : 0;
	    y = (screen.height) ? (screen.height-height)/2 : 0;
	    var popUrl = 'popCardBillDetailInfo.do?user_id='+userId;
	    var win = window.open(popUrl,'popCardBillDetailInfo', 'left=' + x + ',top=' + y + ',width=' + width + ',height=' + height + ',scrollbars=yes,status=yes,menubar=no');
		win.focus();
	}	
	
	// 수수료 팝업 버튼 클릭
	function funcCardFeeDetail(userId) {
		width = 800;
		height = 500;
	    x = (screen.width) ? (screen.width-width)/2 : 0;
	    y = (screen.height) ? (screen.height-height)/2 : 0;
	    var popUrl = 'popCardFeeDetailInfo.do?user_id='+userId;
	    var win = window.open(popUrl,'popCardFeeDetailInfo', 'left=' + x + ',top=' + y + ',width=' + width + ',height=' + height + ',scrollbars=yes,status=yes,menubar=no');
		win.focus();
	}	

	// 과입금액 팝업 버튼 클릭
	function funcCardOverDetail(userId) {
		width = 1000;
		height = 800;
	    x = (screen.width) ? (screen.width-width)/2 : 0;
	    y = (screen.height) ? (screen.height-height)/2 : 0;
	    var popUrl = 'popCardOverDetailInfo.do?user_id='+userId;
	    var win = window.open(popUrl,'popCardOverDetailInfo', 'left=' + x + ',top=' + y + ',width=' + width + ',height=' + height + ',scrollbars=yes,status=yes,menubar=no');
		win.focus();
	}	

	// 상계(스팟) 팝업 버튼 클릭
	function funcCardGasuDetail(userId) {
		width = 1000;
		height = 800;
	    x = (screen.width) ? (screen.width-width)/2 : 0;
	    y = (screen.height) ? (screen.height-height)/2 : 0;
	    var popUrl = 'popCardGasuDetailInfo.do?user_id='+userId;
	    var win = window.open(popUrl,'popCardGasuDetailInfo', 'left=' + x + ',top=' + y + ',width=' + width + ',height=' + height + ',scrollbars=yes,status=yes,menubar=no');
		win.focus();
	}	

	// 정산지급액 팝업 버튼 클릭
	function funcCardRealDetail(userId) {
		width = 1000;
		height = 800;
	    x = (screen.width) ? (screen.width-width)/2 : 0;
	    y = (screen.height) ? (screen.height-height)/2 : 0;
	    var popUrl = 'popCardRealDetailInfo.do?user_id='+userId;
	    var win = window.open(popUrl,'popCardRealDetailInfo', 'left=' + x + ',top=' + y + ',width=' + width + ',height=' + height + ',scrollbars=yes,status=yes,menubar=no');
		win.focus();
	}	
	
	// 대출잔액 팝업 버튼 클릭
	function funcCardLoanDetail(userId) {
		width = 500;
		height = 400;
	    x = (screen.width) ? (screen.width-width)/2 : 0;
	    y = (screen.height) ? (screen.height-height)/2 : 0;
	    var popUrl = 'popCardLoanDetailInfo.do?user_id='+userId;
	    var win = window.open(popUrl,'popCardLoanDetailInfo', 'left=' + x + ',top=' + y + ',width=' + width + ',height=' + height + ',scrollbars=yes,status=yes,menubar=no');
		win.focus();
	}	
	

    // 검색 버튼 클릭
    function funcSearch() {

        var searchStRegDt = document.getElementById('searchStRegDt').value.replace(/-/gi,"");
        var searchEdRegDt = document.getElementById('searchEdRegDt').value.replace(/-/gi,"");

        if(searchStRegDt > searchEdRegDt){ 
            alert("시작일이 종료일보다 큽니다.");
            return false;
        }
        
        var fm  = document.form;
        $("#page").val(1);
        fm.action = 'todayMain.do';
        fm.submit();
    }
    
    // 엑셀다운
    function funcExcel(excelType){
        $("#excelType").val(excelType);
        document.form.action = 'findShoppingSpcExcel.omp';
        document.form.submit(); 
    }
    //////////////////////////////////
    //jQuery datepicker Form set
    ///////////////////////////////// 
    $(function() {
        $("#searchStRegDt").koreadate();
        $("#searchEdRegDt").koreadate();
    });    

    function scrolTop(){ 
        if(document.documentElement.scrollTop!=0 || document.body.scrollTop!=0){
            document.documentElement.scrollTop=0;
            document.body.scrollTop=0;  
        }
    };
    
    function initMoving(target, position, topLimit, btmLimit) {
        if (!target)
            return false;

        var obj = target;
        var initTop = position;
        var bottomLimit = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight) - btmLimit - obj.offsetHeight;
        var top = initTop;

        obj.style.position = 'absolute';

        if (typeof(window.pageYOffset) == 'number') {   //WebKit
            var getTop = function() {
                return window.pageYOffset;
            }
        } else if (typeof(document.documentElement.scrollTop) == 'number') {
            var getTop = function() {
                return Math.max(document.documentElement.scrollTop, document.body.scrollTop);
            }
        } else {
            var getTop = function() {
                return 0;
            }
        }

        if (self.innerHeight) { //WebKit
            var getHeight = function() {
                return self.innerHeight;
            }
        } else if(document.documentElement.clientHeight) {
            var getHeight = function() {
                return document.documentElement.clientHeight;
            }
        } else {
            var getHeight = function() {
                return 500;
            }
        }

        function move() {
            if (initTop > 0) {
                pos = getTop() + initTop;
            } else {
                pos = getTop() + getHeight() + initTop;
            }

            if (pos > bottomLimit)
                pos = bottomLimit;
            if (pos < topLimit)
                pos = topLimit;

            interval = top - pos;
            top = top - interval / 3;
            obj.style.top = top + 'px';

            window.setTimeout(function () {
                move();
            }, 25);
        }

        function addEvent(obj, type, fn) {
            if (obj.addEventListener) {
                obj.addEventListener(type, fn, false);
            } else if (obj.attachEvent) {
                obj['e' + type + fn] = fn;
                obj[type + fn] = function() {
                    obj['e' + type + fn](window.event);
                }
                obj.attachEvent('on' + type, obj[type + fn]);
            }
        }

        addEvent(window, 'load', function () {
            move();
        });
    }    

	</script>
</head>
<div id="gotop" style="position:absolute; left:824px; top:1px; width:238px; z-index:1; height: 137px;">
        <table cellpadding="0" cellspacing="0" border="0" class="data_table_01" width="100%">
            <tr>
                <td class="data_01" style='width:500px; text-align:center;'>&nbsp;카드사</td>
                <td class="data_01" style='width:500px; text-align:center;'>&nbsp;입금총예정액</td>
            </tr>     
<c:set var="total" value="0"/>            
<c:if test='${not empty cardSumList}'>
	<c:forEach var="card" items="${cardSumList}">
<c:set var="total" value="${total + card.prodAmt}"/>	
            <tr>
                <td class="data_01" style=' text-align:center;'>&nbsp; ${card.cdNm}</td>
                <td class="data_02" style=' text-align:right;'><fmt:formatNumber value="${card.prodAmt}" pattern="#,###" /> &nbsp;&nbsp; </td>
            </tr>
	</c:forEach>
            <tr>
                <td class="data_01" style=' text-align:center;'>&nbsp;합계</td>
                <td class="data_02" style=' text-align:right;'><fmt:formatNumber value="${total}" pattern="#,###" /> &nbsp;&nbsp; 
                </td>
            </tr>	
</c:if>  
		</table>            
</div>
<body>

<script type="text/javascript">initMoving(document.getElementById("gotop"), 50, 20, 50);</script>
<div class="con_area" style="width: 800px">
<br><br>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
    <tr>
    	<h1 class="title"><img src="${pageContext.request.contextPath }/images/today.png" alt="admin" /></h1>
    </tr>
</table>
<br>
<br>
<br>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
    <tr>
        <td align="left"><h2 class="tit">※ 회원기본정보 </h2></td>
    </tr>
</table>
<br>
    <div style="margin-top:7px"/>
        <table cellpadding="0" cellspacing="0" border="0" class="data_table_01" width="80%">
            <tr>
                <td class="data_01" style='width:250px; text-align:center;'>&nbsp;고객ID</td>
                <td class="data_02">${model.storeCode}</td>
                <td class="data_01" style='width:200px; text-align:center;'>&nbsp;상호명</td>
                <td class="data_02">${model.storeName}</td>
            </tr>        
            <tr>
                <td class="data_01" style='width:250px; text-align:center;'>&nbsp;법인명</td>
                <td class="data_02"></td>
                <td class="data_01" style='width:250px; text-align:center;'>&nbsp;법인번호</td>
                <td class="data_02">${model.comNum}</td>
            </tr>
            <tr>
                <td class="data_01" style='width:250px; text-align:center;'>&nbsp;대표자명</td>
                <td class="data_02">${model.comCeo}</td>
                <td class="data_01" style='width:250px; text-align:center;'>&nbsp;사업자번호</td>
                <td class="data_02">${model.bizCode}</td>
            </tr>        
            <tr>
                <td class="data_01" style='width:250px; text-align:center;'>&nbsp;주민등록번호</td>
                <td class="data_02">${model.jumin1}-${model.jumin2}</td>
                <td class="data_01" style='width:250px; text-align:center;'>&nbsp;개시일</td>
                <td class="data_02">${model.regDate}</td>
            </tr>      
            <tr>
                <td class="data_01" style='width:250px; text-align:center;'>&nbsp;전화번호</td>
                <td class="data_02">${model.comPhoneNum}</td>
                <td class="data_01" style='width:250px; text-align:center;'>&nbsp;핸드폰번호</td>
                <td class="data_02">${model.comCeoPhoneNum}</td>
            </tr>
            <tr>
                <td class="data_01" style='width:250px; text-align:center;'>&nbsp;입금계좌번호</td>
                <td class="data_02" colspan='3'>(${model.payBank})&nbsp;${model.payBankAccount}</td>
            </tr>
            <tr>
                <td class="data_01" style='width:250px; text-align:center;'>&nbsp;주소</td>
                <td class="data_02" colspan='3'>${model.jibun_address}&nbsp;&nbsp;${model.jibun_details}</td>
            </tr>     
           <tr>
                <td class="data_01" style='width:250px; text-align:center;'>&nbsp;서비스</td>
                <td class="data_02">${model.service}</td>
                <td class="data_01" style='width:250px; text-align:center;'>&nbsp;금일이용한도</td>
                <td class="data_02">
						<c:choose>
						    <c:when test="${model.totalProdAmt < 0}">
								<fmt:formatNumber value="0" pattern="#,###" /> &nbsp;&nbsp;
						    </c:when>
						    <c:otherwise>
 								<fmt:formatNumber value="${model.totalProdAmt}" pattern="#,###" /> 
						    </c:otherwise>
						</c:choose>	                   
                
                </td>
            </tr>                                                                                    
        </table>        
	
<br>
<br>
<br>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
    <tr>
        <td align="left"><h2 class="tit">※ 출금현황 </h2></td>
    </tr>
</table>
<form id="form" name="form" action="" >
<input type="hidden" id="user_id" name="user_id" value="${vo.user_id}"/>
    <div style="margin-top:7px"/>
        <table cellpadding="0" cellspacing="0" border="0" class="data_table_01">
            <tr>
                <td class="data_01" style='width:100px; text-align:center;'>&nbsp;검색일</td>
                <td class="data_02" colspan="3">
                    <input type='text' id="searchStRegDt" name="searchStRegDt" value="${vo.searchStRegDt}" title="YYYY-MM-DD" style="width: 100px;" maxlength="10" readonly/>
                    ~
                    <input type='text' id="searchEdRegDt" name="searchEdRegDt" value="${vo.searchEdRegDt}" title="YYYY-MM-DD" style="width: 100px;" maxlength="10" readonly/>
                     &nbsp;
                     <input type='button' class='button_63_01' value='검색' onclick='funcSearch();'>
                </td>
            </tr>        
        </table>
    <table cellpadding="0" cellspacing="1" border="0" class="data_table_02" style="width:100%;" >
    <colgroup>
        <col width="10%" />
        <col width="10%" />
        <col width="10%" />
        <col width="10%" />
        <col width="10%" />
        <col width="10%" />
        <col width="10%" />
        <col width="10%" />
        <col width="10%" />
        <col width="10%" />        
    </colgroup>
    <thead>
        <tr>
            <th>일자</th>
            <th>총한도</th>
            <th>매출</th>
            <th>카드사입금</th>
            <th>수수료</th>
            <th>과입금액</th>
            <th>상계(스팟)</th>
            <th>이용가능</th>
            <th>정산지급액</th>
            <th>대출잔액</th>
        </tr>
    </thead>
    <tbody>
<c:if test='${empty withDrawInfoList}'>    
    <tr>
        <td colspan="10">
            <span style="padding-top:3px;*padding-top:2px;"><strong>조회된 데이터가 존재하지 않습니다.</strong></span>
        </td>
    </tr>
</c:if>
<c:if test='${not empty withDrawInfoList}'>
	<c:forEach var="vo" items="${withDrawInfoList}">
	    <tr onMouseOver="this.style.background='#FFF9E1'" onMouseOut="this.style.background='#FFFFFF'">
	        <td style="text-align:center;">${vo.transDate}</td>
	        <td style="text-align:center;">0</td>
	        <td style="text-align:center;"><div style="overflow:hidden;text-overflow:ellipsis"><nobr><a href="javascript:funcDetail('${vo.userId}')" ><u><font color=red><fmt:formatNumber value="${vo.prodAmt}" pattern="#,###" /></font></u></a></nobr></div></td>
	        <td style="text-align:center;"><div style="overflow:hidden;text-overflow:ellipsis"><nobr><a href="javascript:funcCardDetail('${vo.userId}')" ><u><font color=red><fmt:formatNumber value="${vo.cardProdAmt}" pattern="#,###" /></font></u></a></nobr></div></td>
	        <td style="text-align:center;"><div style="overflow:hidden;text-overflow:ellipsis"><nobr><a href="javascript:funcCardFeeDetail('${vo.userId}')" ><u><font color=red><fmt:formatNumber value="${vo.payProdFee}" pattern="#,###" /></font></u></a></nobr></div></td>
	        <td style="text-align:center;"><div style="overflow:hidden;text-overflow:ellipsis"><nobr><a href="javascript:funcCardOverDetail('${vo.userId}')" ><u><font color=red><fmt:formatNumber value="0" pattern="#,###" /></font></u></a></nobr></div></td>
	        <td style="text-align:center;"><div style="overflow:hidden;text-overflow:ellipsis"><nobr><a href="javascript:funcCardGasuDetail('${vo.userId}')" ><u><font color=red><fmt:formatNumber value="0" pattern="#,###" /></font></u></a></nobr></div></td>
	        <td style="text-align:center;">0</td>
	        <td style="text-align:center;"><div style="overflow:hidden;text-overflow:ellipsis"><nobr><a href="javascript:funcCardRealDetail('${vo.userId}')" ><u><font color=red><fmt:formatNumber value="${vo.payProdAmt}" pattern="#,###" /></font></u></a></nobr></div></td>
	        <td style="text-align:center;"><div style="overflow:hidden;text-overflow:ellipsis"><nobr><a href="javascript:funcCardLoanDetail('${vo.userId}')" ><u><font color=red><fmt:formatNumber value="${vo.totalProdAmt}" pattern="#,###" /></font></u></a></nobr></div></td>
	    </tr>
    </c:forEach>
</c:if>
    </tbody>
    </table>
</form>

<br>
<br>
<br>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
    <tr>
        <td align="left"><h2 class="tit">※ 스팟현황 </h2></td>
    </tr>
</table>
    <div style="margin-top:7px"/>
  <table cellpadding="0" cellspacing="1" border="0" class="data_table_02" style="width:100%;" >    
    <colgroup>
        <col width="10%" />
        <col width="10%" />
        <col width="10%" />
        <col width="10%" />
        <col width="10%" />
        <col width="10%" />
        <col width="10%" />
    </colgroup>
    <thead>
        <tr>
            <th>한도금액</th>
            <th>당일지급액</th>
            <th>전일잔액</th>
            <th>당일상환액</th>
            <th>스팟잔액</th>
            <th>스팟수수료</th>
            <th>정산지급액</th>
        </tr>
    </thead>
    <tbody>
	    <tr onMouseOver="this.style.background='#FFF9E1'" onMouseOut="this.style.background='#FFFFFF'">
	        <td style="text-align:center;">0</td>
	        <td style="text-align:center;">0</td>
	        <td style="text-align:center;">0</td>
	        <td style="text-align:center;">0</td>
	        <td style="text-align:center;">0</td>
	        <td style="text-align:center;">0</td>
	        <td style="text-align:center;">0</td>	        
	    </tr>
    </tbody>
</table>

</div>
<br><br>

 
</body>
